﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="log.aspx.cs" 
Inherits="GeniusWebApplication.log" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>Genius，改变分享！</title>
<script src="assets/js/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="assets/js/jquery.motionCaptcha.0.2.js"></script>
<link href="./115/home.css" rel="stylesheet" type="text/css">

<link rel="stylesheet" href="assets/css/jquery.motionCaptcha.0.2.css" />

<link href="assets/css/styles.css" rel="stylesheet" type="text/css" media="screen" />
</head>

<body>
<div class="container">
	
	
	<div class="col-main">
		<div class="feature-show" id="js_content_list">
                    <div class="feat-logo"></div>
                        <div class="feat-con bc-blank"></div>
			<div class="feat-con bc-cloud" con="1" style="display: none; "></div>
			<div class="feat-con bc-notebook" con="1" style="display: none; "></div>
			<div class="feat-con bc-circle" con="1" style="display: none; "></div>
			<div class="feat-con bc-message" con="1" style=""></div>
		</div>
		<div class="login-box">
                    
        <form id="js_login_form" action="./index.aspx" method="post" rel="login" class="mc-active">
			<ul>
				<li>
					<label for="account" id="acc">请输入邮箱</label>
                                        
                    <input type="text" name="login[account]" id="account" class="text" errortype="notempty" errmsgtype="1" value="" tabindex="1" errmsg="请输入帐号" onclick="clickAccount();">
				</li>
				<li>
					<label for="passwd" id="passw">请输入您的密码</label>
                    <input type="password" name="login[passwd]" id="passwd" errortype="notempty" errmsgtype="1" class="text" tabindex="2" errmsg="请输入密码" onclick="clickPasscode();">
                </li>
				<li class="s">
					<button type="button" class="btn-login" onclick="clickLog();" id="btn_log"><i>登录</i></button>
				</li>
				<li class="status-save">
					<input type="checkbox" id="autologin" name="login[time]" tabindex="4">
					<label for="autologin">保持我的登录状态</label>
				</li>
				<li>
					<div id="mc">
						<p>请在下图处绘制相同的图形(<a onclick="window.location.reload()" title="Click for a new shape">换一张</a>)</p>
						<canvas id="mc-canvas" width="200" height="134" class="check mc-valid">
							Your browser doesn't support the canvas element - please visit in a modern browser.
						</canvas>
                        <script>
                            var canvas_draw = 0;
                        </script>
					</div>
				</li>

			</ul>
        </form>
		</div>
		
		
		<div class="festival-logo" id="js_festival_logo" style="top: 280px; margin-left: -345px; display: block; "><object type="application/x-shockwave-flash" data="https://www.115.com/static/images/festival/european_cup.swf" width="670" height="220"><param name="quality" value="high"><param name="wmode" value="transparent"><param name="menu" value="false"></object></div>
	</div>
</div>
             <script type="text/javascript">
                 jQuery(document).ready(function ($) {

                     // Do the biznizz:
                     $('#js_login_form').motionCaptcha({
                         shapes: ['triangle', 'x', 'rectangle', 'circle', 'check', 'zigzag', 'arrow', 'delete', 'pigtail', 'star'],
                         errorMsg: '请再画一次！',
                         successMsg: '正确绘制！'
                     });


                 });
                 function clickAccount() {
                     $('#acc').html("");
                     
                 }
                 function clickPasscode() {
                     $('#passw').html("");
                     
                 }
                 //邮箱地址格式校验
                 function isValidMail(sText) {
                     var reMail = /^(?:\w+\.?)*\w+@(?:\w+\.?)*\w+$/;
                     return reMail.test(sText);
                 }
                 function clickLog() {
                     var a = document.getElementById("btn_log");
                     var e_mail=$("#account").val();
                     var passwd=$("#passwd").val();
                     if (canvas_draw == 0) {
                         alert("验证码错误！");
                     }
                    else if(e_mail == ""){
                        alert("邮箱不为空！");
                    }
                    else if (!isValidMail(e_mail)) {
                        alert("邮箱格式错误！");
                    }
                     else if (passwd=="") {
                        alert("密码不为空！");
                    }
                    else if (e_mail.length >50) {
                        alert("邮箱过长！");
                    }
                    else if (passwd.length>30) {
                        alert("密码过长！");
                    }
                    else {
                        $.ajax({
                            type: "POST",
                            url: "log.aspx/ajaxLogUser",
                            data: "{username:'" + e_mail + "',password:'" + passwd + "'}",
                            contentType: "application/json; charset=utf-8",
                            success: function (data) {
                                //09301007@bjtu.edu.cn
                                //alert(data.d);
                                //var dataObj = eval("(" + data + ")");
                                //alert(dataObj.d);
                                //var info = eval("(" + dataObj.d + ")");
                                var info = eval("(" + data.d + ")");
                                var suc = info.result;
                                var msg = info.message;
                                if (suc == 1) {
                                    
                                    $("#account").val("");
                                    $("#passwd").val("");
                                    location.href = "./index.aspx?categoryId=1";
                                } else {
                                    alert("登陆失败：" + msg);
                                }
                            }
                        });
                    }
                 }
        </script>

</body></html>
